package in.jiemin.springboot.controller;

import in.jiemin.springboot.config.ThriftConfig;
import in.jiemin.springboot.service.HelloService;
import org.apache.thrift.TException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {


    @Autowired
    ThriftConfig thriftConfig;


    @RequestMapping("/hello")
    public Object hello(){

        HelloService.Client client = thriftConfig.serviceMap.get("helloService");

        try {
            return client.sayHello();
        } catch (TException e) {
            e.printStackTrace();
        }

        return "";

    }


}
